home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / VISUALBA / SCROLVB.ZIP / SCROLL-X.FRM < prev   
Text File  |  1994-02-01  |  3KB  |  102 lines

  1. VERSION 2.00
  2. Begin Form frmScroll 
  3.    BackColor       =   &H00FFFF00&
  4.    BorderStyle     =   0  'None
  5.    Caption         =   "frmScroll"
  6.    ControlBox      =   0   'False
  7.    Height          =   1020
  8.    Left            =   2520
  9.    LinkTopic       =   "Form2"
  10.    MaxButton       =   0   'False
  11.    MDIChild        =   -1  'True
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   41
  14.    ScaleMode       =   3  'Pixel
  15.    ScaleWidth      =   265
  16.    Top             =   3435
  17.    Width           =   4095
  18.    Begin CommandButton cmdHome 
  19.       Caption         =   "Home"
  20.       Height          =   375
  21.       Index           =   0
  22.       Left            =   2040
  23.       TabIndex        =   1
  24.       Top             =   120
  25.       Width           =   1815
  26.    End
  27.    Begin CommandButton cmdStart 
  28.       Caption         =   "Click To Start"
  29.       Height          =   375
  30.       Left            =   120
  31.       TabIndex        =   0
  32.       Top             =   120
  33.       Width           =   1815
  34.    End
  35. End
  36.  
  37. ' SCROLL-X.FRM - Declarations.
  38.  
  39.     DefInt A-Z
  40.  
  41. ' End Of Declarations.
  42.  
  43. Sub cmdHome_Click (Index As Integer)
  44.  
  45. ' All of these buttons just move the scrolling form back up to the upper
  46. ' left corner, where it was before you started scrolling.
  47.  
  48.     frmScroll.Move 0, 0
  49.  
  50. End Sub
  51.  
  52. Sub cmdStart_Click ()
  53.  
  54. ' Hide this button right away.
  55.  
  56.     cmdStart.Visible = False
  57.  
  58. ' These are the PIXEL sizes that the scrolling form will be. Any number
  59. ' up to 32000 is alright. Over that size, things get flakey!
  60.  
  61.     GoalWidth = 400
  62.     GoalHeight = 400
  63.  
  64. ' Since the MDI child form external size is "Twips", you must convert the
  65. ' pixel goal to Twips, and THEN actually change the form size. In other
  66. ' words, when you give VB a Width or Height value, it expects a Twip value.
  67. '
  68. ' To get this Twip value, you multiply your pixel size goal times the
  69. ' "number of Twips per pixel". VB has a built-in "Screen" object that will
  70. ' give you that number (it varies with different monitor types).
  71.  
  72.     frmScroll.Width = GoalHeight * Screen.TwipsPerPixelX
  73.     frmScroll.Height = GoalHeight * Screen.TwipsPerPixelY
  74.  
  75. ' Now duplicate the "Home" command button a few times, just to have some
  76. ' other sample controls on the form. These are not critical, and can be
  77. ' removed and replaced with any other kind of control.
  78.  
  79.     For temp = 1 To 15
  80.     Load cmdHome(temp)
  81.     Next temp
  82.  
  83. ' Adjust all of the cmdHome buttons, including #0, which was on the form
  84. ' at design time.
  85.  
  86.     For x = 0 To 3
  87.     For y = 0 To 3
  88.         ' Figure out which one to move (0 to 15).
  89.         temp = (y * 4) + x
  90.         ' Calculate new location.
  91.         offsetX = 10 + (x * 100)
  92.         offsetY = 30 + (y * 100)
  93.         ' Move it, change caption, and show it.
  94.         cmdHome(temp).Move offsetX, offsetY, 80, 40
  95.         cmdHome(temp).Caption = "Home #" + Trim(temp)
  96.         cmdHome(temp).Visible = True
  97.     Next y
  98.     Next x
  99.  
  100. End Sub
  101.  
  102.